from .control import *

"""
作用：实现事件监听
"""

class UrlsListPanelListener(UrlsListPanelControl):

    def __init__(self, parent=None):
        super().__init__(parent=parent)

        '''
            树形列表操作
        '''
        self.Bind(wxdv.EVT_DATAVIEW_ITEM_ACTIVATED, self.onItemDBClick, self.treeListData)
        self.Bind(wxdv.EVT_DATAVIEW_ITEM_CONTEXT_MENU, self.onItemRightClick, self.treeListData)
        self.Bind(wxdv.EVT_DATAVIEW_SELECTION_CHANGED, self.onItemSelect, self.treeListData)

        '''
            工具栏
        '''
        self.Bind(wx.EVT_BUTTON, self.onBtnRefresh, self.btn_refresh)
        self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.onSearch, self.searcher)

        '''
            右击菜单项
        '''
        self.Bind(wx.EVT_MENU, self.onPopupOpenUrl, id=self.popup_open_url)
        self.Bind(wx.EVT_MENU, self.onPopupOpenViewPath, id=self.popup_open_view_path)
        self.Bind(wx.EVT_MENU, self.onPopupOpenUrlPath, id=self.popup_open_url_path)
        self.Bind(wx.EVT_MENU, self.onPopupOpenTemplatePath, id=self.popup_open_template_path)
        self.Bind(wx.EVT_MENU, self.onPopupModifyUrl, id=self.popup_modify_url)
        self.Bind(wx.EVT_MENU, self.onPopupInsertFunc, id=self.popup_insert_func)
        self.Bind(wx.EVT_MENU, self.onPopupGetCode, id=self.popup_get_code)
        self.Bind(wx.EVT_MENU, self.onPopupShowMvcMtv, id=self.popup_show_mvc_mtv)
